<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>带时间轴的响应式多列轮播</title>
    <link rel="stylesheet" href="./css/swiper-bundle.min.css">
    <style>
        html,
        body{
            margin: 0;
            padding: 0;
        }
        .container{
            max-width: 1600px;
            min-height: 300px;
            /* border: 2px solid red; */
            margin: 50px auto;
        }
        .swiper1{
            height: 300px;
        }
        .swiper1 .swiper-slide{
            box-sizing: border-box;
            padding: 0 10px 10px;
        }
        .swiper1 .swiper-slide .slide-content{
            height: 100%;
            box-shadow: 0 2px 5px #ddd;
            border: 1px solid #ddd;
        }
        /* .swiper1 .swiper-slide:nth-child(2n){
            background-color: khaki;
        } 
        .swiper1 .swiper-slide:nth-child(2n+1){
            background-color: skyblue;
        }  */
        .swiper2{
            height: 100px;
            /* background-color: hotpink; */
        }
        .timeline{
            width: calc(100% - 100px);
            /* border: 1px solid red; */
            margin: 0 auto;
            position: relative;
        }
        .timeline .swiper-button-prev1, .timeline .swiper-button-next1{
            width: 48px;
            height: 48px;
            /* background-color: khaki; */
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background-image: url(./images/arrow-active.png);
        }

        .timeline .swiper-button-prev1{
            background-image: url(./images/arrow-active.png);
            transform: translateY(-50%) rotate(180deg);
            left: -50px;
        }

        .timeline .swiper-button-next1{
            background-image: url(./images/arrow-active.png);
            right: -50px;
        }
        .timeline .swiper-button-prev1.swiper-button-disabled{
            opacity: 0.2;
        }

        .timeline .swiper-button-next1.swiper-button-disabled{
            opacity: 0.2;
        }
        .swiper2 .swiper-slide{
            /* border: 1px solid red; */
        }

        /* 绘制水平线 */
        .swiper2 .swiper-slide::before{
            content: "";
            width: 100%;
            height: 2px;
            background-color: #ddd;
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
        }
        /* 绘制圆圈 */
         .swiper2 .swiper-slide::after{
            content: "";
            width: 7px;
            height: 7px;
            border: 5px solid #ddd;
             background-color: #ddd;
            position: absolute;
            border-radius: 50%;
            top: 50%;
            transform: translateY(-50%);
         }
         .swiper2 .swiper-slide.swiper-slide-thumb-active::after{
            background-color: #fff;
            border-color: skyblue;
         }
         /* 媒体查询 */
         @media screen and (max-width: 1280px) {
            .hide{
                display: none;
            }
         }
    </style>
</head>
<body>
    <div class="container">
        <!-- 大事记列表 -->
        <div class="swiper swiper1" id="swiper1">
            <div class="swiper-wrapper">
                <div class="swiper-slide"><div class="slide-content">2024</div></div>
                <div class="swiper-slide"><div class="slide-content">2023</div></div>
                <div class="swiper-slide"><div class="slide-content">2022</div></div>
                <div class="swiper-slide"><div class="slide-content">2021</div></div>
                <div class="swiper-slide"><div class="slide-content">2020</div></div>
                <div class="swiper-slide"><div class="slide-content">2019</div></div>
                <div class="swiper-slide"><div class="slide-content">2018</div></div>
                <div class="swiper-slide"></div>
                <div class="swiper-slide hide"></div>
            </div>
        </div>
        <div class="timeline">
            <div class="swiper swiper2" id="swiper2">
                <div class="swiper-wrapper">
                    <div class="swiper-slide"><div class="slide-content">2024</div></div>
                    <div class="swiper-slide"><div class="slide-content">2023</div></div>
                    <div class="swiper-slide"><div class="slide-content">2022</div></div>
                    <div class="swiper-slide"><div class="slide-content">2021</div></div>
                    <div class="swiper-slide"><div class="slide-content">2020</div></div>
                    <div class="swiper-slide"><div class="slide-content">2019</div></div>
                    <div class="swiper-slide"><div class="slide-content">2018</div></div>
                </div>
            </div>
            <!-- 如果需要导航按钮 -->
            <div class="swiper-button-prev1"></div>
            <div class="swiper-button-next1"></div>
        </div>
        
    </div>
    <script src="./js/swiper-bundle.min.js"></script>
    <script>       
        // 时间轴 -- 缩略图
        var mySwiper2 = new Swiper ('#swiper2', {
            direction: 'horizontal', // 水平切换选项
            slidesPerView : 4,
            watchSlidesVisibility: true,//防止不可点击
            // 如果需要前进后退按钮
            navigation: {
                nextEl: '.swiper-button-next1',
                prevEl: '.swiper-button-prev1',
            },
            breakpoints: { 
                1280: {  //当屏幕宽度大于等于1280
                    slidesPerView: 6
                }
            }
        }) 

        // 大事记 -- 大图 
        var mySwiper1 = new Swiper ('#swiper1', {
            direction: 'horizontal', // 水平切换选项
            slidesPerView : 2,
            spaceBetween : 10,
            thumbs: {
                swiper: mySwiper2,
                 multipleActiveThumbs: false,
            },
            breakpoints: { 
                1280: {  //当屏幕宽度大于等于1280
                    slidesPerView: 3,
                    spaceBetween: 10
                }
            }
        }) 
    </script>
</body>
</html>